package com.aids_malaria.util;

import android.content.Context;
import android.graphics.Color;
import android.view.View;

import com.aids_malaria.R;
import com.aids_malaria.app.App;
import com.bigkoo.pickerview.builder.TimePickerBuilder;
import com.bigkoo.pickerview.listener.OnTimeSelectListener;
import com.bigkoo.pickerview.view.TimePickerView;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class DateUtil {

    private static SimpleDateFormat fullTimeFormatter;
    private static SimpleDateFormat YMDTimeFormatter;

    public static SimpleDateFormat getFullTimeFormatter() {
        if (fullTimeFormatter == null) {
            fullTimeFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        }
        fullTimeFormatter.setTimeZone(TimeZone.getDefault());
        return fullTimeFormatter;
    }

    public static SimpleDateFormat getYMDTimeFormatter() {
        if (YMDTimeFormatter == null) {
            YMDTimeFormatter = new SimpleDateFormat("yyyy-MM-dd");
        }
        YMDTimeFormatter.setTimeZone(TimeZone.getDefault());
        return YMDTimeFormatter;
    }

    public static TimePickerView newTimeSelect(Context context,OnTimeSelectListener onTimeSelectListener){
        return new TimePickerBuilder(context, onTimeSelectListener).setTitleBgColor(Color.WHITE)//标题背景颜色 Night mode
                .setTitleText(App.getAppContext().getString(R.string.hint_select_time))//标题文字
                .setType(new boolean[]{true, true, true, true, true, true}).build();
    }

}
